package health.lm.com.shop.presenter;

import java.util.ArrayList;
import java.util.List;

import health.lm.com.component_base.base.mvp.contract.XPresent;
import health.lm.com.network.callback.SimpleCallBack;
import health.lm.com.shop.activity.HLPrivateMessageActivity;
import health.lm.com.shop.entity.HLPrivateMessageEntity;
import health.lm.com.shop.entity.HLPrivateMessageResponse;
import health.lm.com.shop.model.MallModel;

/**
 * Created by Android Studio .
 * Project：hlian health.lm.com.shop.presenter
 * Date：2019/8/9 9:52
 * Introduce：私信
 */
public class HLPrivateMessagePresenter extends XPresent<HLPrivateMessageActivity> {
    public void getData(int page, int pageSize) {
        MallModel.getInstance().getPrivateChatList(page, pageSize, new SimpleCallBack<HLPrivateMessageResponse>() {
            @Override
            public void onSuccess(HLPrivateMessageResponse pHLPrivateMessageResponse) {
                if (hasV()) getV().setNewData(pHLPrivateMessageResponse.getList());
            }
        });
    }

    @Deprecated
    public List<HLPrivateMessageEntity> getDataSource() {
        List<HLPrivateMessageEntity> entities = new ArrayList<>();
        for (int a = 0; a < 10; a++) {
            HLPrivateMessageEntity messageEntity = new HLPrivateMessageEntity();
            messageEntity.setAvatar("http://image109.360doc.com/DownloadImg/2018/03/1008/126782666_1_2018031008485635.jpeg");
            messageEntity.setName("测试名称" + a);
            messageEntity.setId(a);
            messageEntity.setTime("2018-08-09");
            messageEntity.setNum(a + "");
            messageEntity.setDepartment("联络部");
            entities.add(messageEntity);
        }
        return entities;
    }
}
